# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=git-dump
_pkgname=node-git-dump
pkgver=7.4c9a2a9
pkgrel=1
pkgdesc='Dump the contents of a remote git repository without directory listing enabled.'
arch=('any')
groups=('blackarch' 'blackarch-scanner' 'blackarch-code-audit')
url='https://github.com/bahamas10/node-git-dump'
license=('MIT')
depends=('nodejs' 'git')
makedepends=('npm' 'git')
source=("git+https://github.com/bahamas10/$_pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd "$_pkgname"

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd "$_pkgname"

  _npmdir="$pkgdir/usr/lib/node_modules/"

  install -dm 755 "$_npmdir"

  cd "$_npmdir"

  npm install --user root -g --prefix "$pkgdir/usr" "$pkgname@"

  cd "$srcdir/$_pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

